﻿#pragma once
#include "AsChartBasics.h"

AS_MEMBER_CLASS_DECLARATION(AsLineChartController);

class AS_GRAPHICS_EXPORT AsLineChartController {
public:
	AsLineChartController(QChartView* chartView);
	AsLineChartController(QChartView* chartView, QChart* chart);
	~AsLineChartController();

private:
	AS_MEMBER_CLASS(AsLineChartController)* m;

public:
	QtCharts::QChartView* chartView();
	QtCharts::QChart* chart();

	void pushTo(QLayout* layout);

public:
	void setAntialiasing(bool b = true);

public:
	void setTitle(const QString& title);
	void setTheme(AsChart::Theme theme);
	void setAnimationOptions(AsChart::AnimationOption option);
	void setLegendVisible(bool visible);

public:
	QLineSeries* lineSeries_add(const QString& name, const QVector<QPointF>& series);
	void lineSeries_delete(const QString& name);
	void lineSeries_clear();

public:
	QValueAxis* addAxisX(const QString& title = "X", const QPair<qreal, qreal>& range = { 0, 100 }, int tick_count = 0, int minor_count = 0, AsChart::Alignment aligment = AsChart::Alignment::AlignBottom, bool isVisible_gridLine = true, bool isVisible_line = true);
	QValueAxis* addAxisY(const QString& title = "Y", const QPair<qreal, qreal>& range = { 0, 100 }, int tick_count = 0, int minor_count = 0, AsChart::Alignment aligment = AsChart::Alignment::AlignLeft, bool isVisible_gridLine = true, bool isVisible_line = true);
	void bindAxis(QValueAxis* axisX, QValueAxis* axisY, QAbstractSeries* series);
	void deleteAxis(QValueAxis* axis);
	void clearAxis();

public:
	void points_init();
	void points_delete();
	void points_setMarkSize(qreal size);
	void points_setLabelVisible(bool visible);
	void points_setLabelFormat(const QString& format);

public:
	void experiment();

};

